package main

import "fmt"

func TestA() {
	fmt.Println("func TestA()")
}

func TestB() (err error) {
	defer func() {
		if x := recover(); x != nil {
			err = fmt.Errorf("internal error: %v", x)
		}
	}()

	panic("func TestB() panic")
}

func TestC() {
	fmt.Println("func TestC()")
}

func test() {
	defer func(){
		fmt.Println(recover())
	}()

	defer func() {
		panic("defer panic")
	}()

	panic("test panic")
}

func main() {
	//TestA()
	//err := TestB()
	//fmt.Println(err)
	//TestC()

	test()
}
